From 8d9414c228a0d518581184cb80f28f0a5d1caedc Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 26 Dec 2017 20:03:19 -0500 Subject: [PATCH] Avoid excess notification for GdkCellRendererPixbuf::icon-size We have a test that checks this, and it is right thing to do. --- gtk/gtkcellrendererpixbuf.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c index d6a610c0a3..b438ddc5c3 100644 --- a/gtk/gtkcellrendererpixbuf.c +++ b/gtk/gtkcellrendererpixbuf.c @@ -198,7 +198,7 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class) P_("The GtkIconSize value that specifies the size of the rendered icon"), GTK_TYPE_ICON_SIZE, GTK_ICON_SIZE_INHERIT, - GTK_PARAM_READWRITE)); + GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY)); /** * GtkCellRendererPixbuf:icon-name: @@ -336,6 +336,19 @@ take_image_definition (GtkCellRendererPixbuf *cellpixbuf, priv->image_def = def; } +static void +gtk_cell_renderer_pixbuf_set_icon_size (GtkCellRendererPixbuf *cellpixbuf, + GtkIconSize icon_size) +{ + GtkCellRendererPixbufPrivate *priv = cellpixbuf->priv; + + if (priv->icon_size == icon_size) + return; + + priv->icon_size = icon_size; + g_object_notify (G_OBJECT (cellpixbuf), "icon-size"); +} + static void gtk_cell_renderer_pixbuf_set_property (GObject *object, guint param_id, @@ -373,7 +386,7 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object, take_image_definition (cellpixbuf, gtk_image_definition_new_texture (g_value_get_object (value))); break; case PROP_ICON_SIZE: - priv->icon_size = g_value_get_enum (value); + gtk_cell_renderer_pixbuf_set_icon_size (cellpixbuf, g_value_get_enum (value)); break; case PROP_ICON_NAME: take_image_definition (cellpixbuf, gtk_image_definition_new_icon_name (g_value_get_string (value))); -- 2.30.2